﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TestTcpSockets.Plugin.Interface;
using System.IO;

namespace TestTcpSockets.Plugin.System
{
    public class Locate : INabPlugin
    {
        #region INabPlugin Members

        public bool HandleRequest(byte[] rawrequest, string request, Stream reply)
        {
            if (request.Substring(8,10) == "locate.jsp")
            {
                StringBuilder locateServers = new StringBuilder();
                locateServers.Append("ping artiche.pck.nerim.net\n");
                locateServers.Append("broad artiche.pck.nerim.net\n");
                locateServers.Append("xmpp_domain artiche.pck.nerim.net\n");
                
                for(int i=0;i<locateServers.Length;i++)
                {
                    reply.WriteByte((byte)locateServers[i]);
                }
                //writer.Write(locateServers.ToString());

                return true;
            }
            return false;
        }

        #endregion
    }
}
